//
//  ZYCHomeRootCell.m
//  ZDSC
//
//  Created by ZDTX on 2021/7/18.
//

#import "ZYCHomeRootCell.h"
#import "ZYCNewBulletinModel.h"
@interface ZYCHomeRootCell()

@property (nonatomic, strong) UILabel *titleLabel;
@property (nonatomic, strong) UILabel *timeLabel;
@property (nonatomic, strong) UILabel *line;
@end
@implementation ZYCHomeRootCell

- (void)setModel:(ZYCNewBulletinModel *)model{
    _model = model;
    _titleLabel.text = model.title;
    _timeLabel.text = [NSString stringWithFormat:@"%@  %@",model.createTime,model.publisher];
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.backgroundColor = HEX_RGB(kBgWhiteColor);
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        [self.contentView addSubview:self.titleLabel];
        [self.contentView addSubview:self.timeLabel];
        [self.contentView addSubview:self.line];
        [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.contentView).offset(19.0f);
            make.right.equalTo(self.contentView).offset(-19.0f);
            make.top.equalTo(self.contentView).offset(10.0f);
        }];
        
        [self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.titleLabel);
            make.bottom.equalTo(self.contentView).offset(-10.0f);;
        }];
        
        [self.line mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.right.equalTo(self.contentView);
            make.bottom.equalTo(self.contentView);
            make.height.mas_equalTo(1.0f);;
        }];
    }
    return self;
}

- (UILabel *)titleLabel {
    if (!_titleLabel) {
        _titleLabel = [UILabel LabelWithFont:kSystemBoldFont(15) titleColor:HEX_RGB(kTitleDrakBlackColor) textAlignment:ZZTextAlignmentLeft];
        _titleLabel.numberOfLines = 0;
    }
    return _titleLabel;
}

- (UILabel *)timeLabel {
    if (!_timeLabel) {
        _timeLabel = [UILabel LabelWithFont:kCustomFont(@"PingFangSC-Regular", 13) titleColor:HEX_RGB(kTitleLightGrayColor) textAlignment:ZZTextAlignmentLeft];
    }
    return _timeLabel;
}

- (UILabel *)line {
    if (!_line) {
        _line = [[UILabel alloc] init];
        _line.backgroundColor = HEX_RGB(kBgSepeColor);
    }
    return _line;
}
- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
